package cn.iune.web.system.controllers;

//import org.apache.logging.log4j.LogManager;
//import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.justep.baas.Utils;

import cn.iune.backcenter.author.ISaOporgService;
import cn.iune.platform.dictionary.IRegionInfoService;


@Controller
public class SystemController {
	
//	private final Logger log = LogManager.getLogger(SystemController.class);
	
	@Autowired
 	private ISaOporgService saOporgService;
	
	
	@Autowired
	private IRegionInfoService regionInfoService;
	
	
	@RequestMapping(value="/system/util/getCurrentDate",method=RequestMethod.GET)
	@ResponseBody
	public String getCurrentDate(){
		return Utils.getCurrentDate().toString();
	}
	
	@RequestMapping(value="/system/util/getCurrentDateTime",method=RequestMethod.GET)
	@ResponseBody
	public String getCurrentDateTime(){
		return Utils.getCurrentDateTime().toString();
	}

	
/*
	@RequestMapping(value="/security/systemXML/query",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject sytemXMLQuery(@RequestBody JSONObject data) throws Exception {
		return systemXMLUtil.query(data);
	}

	@RequestMapping(value="/security/systemXML/save",method=RequestMethod.POST)
	@ResponseBody
	public int systemXMLSave(@RequestBody JSONObject data) throws Exception {
		return systemXMLUtil.save(data);
	}

	@RequestMapping(value="/security/systemXML/delete",method=RequestMethod.GET)
	@ResponseBody
	public void systemXMLDelete(@RequestParam(value="id",required=true) String id) throws DocumentException, IOException{
//		log.info("------------要删除的id-->"+id);
		systemXMLUtil.delete(id);
	}
*/
	


/*	
	@RequestMapping(value="/security/systemBillXML/query",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject sytemBillXMLQuery(@RequestBody JSONObject data) throws Exception {
		return systemBillXMLUtil.query(data);
	}

	@RequestMapping(value="/security/systemBillXML/save",method=RequestMethod.POST)
	@ResponseBody
	public int sytemBillXMLSave(@RequestBody JSONObject data) throws Exception {
		return systemBillXMLUtil.save(data);
	}

	@RequestMapping(value="/security/systemBillXML/delete",method=RequestMethod.GET)
	@ResponseBody
	public void sytemBillXMLDelete(@RequestParam(value="id",required=true) String id) throws DocumentException, IOException{
//		log.info("------------要删除的id-->"+id);
		systemBillXMLUtil.delete(id);
	}
*/
	
	//经办人等组织机构
	@RequestMapping(value="/remote/org/tree/query",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject orgQuery(@RequestBody JSONObject data) {
		return saOporgService.queryData(data);
	}
	
	
	//////////////////////数据字典////////////////////////////////////////////////
	
	//获取区域属性数据（erp系统需要调用）
	@RequestMapping(value="/remote/regionInfo/tree/query",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject regionInfoQuery(@RequestBody JSONObject data) {
		return regionInfoService.queryData(data);
	}
	
	//////////////////////////////////////////////////////////////////////////////

}
